package com.zgkxzx.java.mutilThread.CirlicBarierTest;

import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;

/**
 * 创建者   zgkxzx
 * 创建日期 2017/12/30.
 * 功能描述
 */

public class CircleThread extends Thread {
    private CyclicBarrier cyclicBarrier;

    public CircleThread(CyclicBarrier cyclicBarrier){
        this.cyclicBarrier = cyclicBarrier;
    }

    @Override
    public void run() {
        System.out.println("开始准备执行");

        try {
            cyclicBarrier.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (BrokenBarrierException e) {
            e.printStackTrace();
        }

        System.out.println("执行。。。。");
    }
}
